{% extends "base.html" %}

{% block body %}

<div class="main">
    <ul>

        {% for i in blogs %}
        <li>
            <time class="blog_time" datetime="{{i.date}}">
                <a href="/{{i.id}}" target="_blank" title="{{i.title}}">
                    <span>{{locale.format_date(i.date)}}</span>
                </a>
            </time>
            <div class="blog_time_icon"></div>
            <div class="blog_content">
                <a href="/{{i.id}}" target="_blank"><h2>{{i.title}}</h2></a>

                <p>{% raw i.summary %}</p>
            </div>
        </li>

        {% end %}
        <li id="last_li">
            <div class="blog_time_icon"></div>
        </li>

    </ul>
    <div id="loading" style="display: none;">
        ......
    </div>
</div>
{% end %}

{% block bottom %}
<script type="application/javascript">
/*    $(document).ready(function () {
        $(window).scroll(function () {
            totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop());
            if ($(document).height() <= totalheight + 300) {
                if ($(".loading:hidden").length) {
                    //只有加载提示框存在且隐藏的时候在开始加载
                    $(".loading").show();
                    date = $(".cbp_tmtimeline>li>time:last").attr('datetime');
                    $.get("/Ajax/" + date, function (r) {
                        $(".cbp_tmtimeline>li:last").before(r);
                        $(".loading").hide();
                        if (r.length < 1) {//如果没有获取到结果就表明是最后一个了，移除加载提示框
                            $(".loading").remove();
                        }
                    }, 'html');
                    console.log("ok");
                }

            }
        });

    });*/
</script>
{% end %}